
import 'package:permission_handler/permission_handler.dart';

class PermissionRequest {
  static Future<Map<Permission, PermissionStatus>> requestPermissions(
      List<Permission> permissions) async {
    Map<Permission, PermissionStatus> statuses = await permissions.request();
    return statuses;
  }

  static Future<bool> isLackPermissions(List<Permission> permissions) async {
    bool lack = true;
    permissions.forEach((element) async {
      if (await element.status.isGranted) {
        lack = false;
      } else {
        lack = true;
      }
    });
    return lack;
  }

  static Future<bool> isLackPermission(Permission permission) async {
    if (await permission.status.isGranted) {
      return false;
    } else {
      return true;
    }
  }
}
